package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 社团创建申请类
 *
 * @author liujiale
 */
public class ClubApplication extends Application {

    /** 社团申请ID */
    private int clubApplicationID;

    /** 待处理的社团 */
    private Club pendingClub;

    /**
     * 构造函数
     *
     * @param clubApplicationID 社团创建申请ID
     * @param pendingClub       待处理的社团
     */
    public ClubApplication(int clubApplicationID, Club pendingClub) {
        this.clubApplicationID = clubApplicationID;
        this.pendingClub = pendingClub;
    }

    /**
     * 实现父类的构造函数
     *
     * @param applicationTime   申请时间
     * @param status            申请状态
     * @param description       描述
     * @param clubApplicationID 社团创建申请ID
     */
    public ClubApplication(Date applicationTime, int status, String description, int clubApplicationID) {
        super(applicationTime, status, description);
        this.clubApplicationID = clubApplicationID;
    }

    /**
     * Gets club application id.
     *
     * @return the club application id
     */
    public int getClubApplicationID() {
        return clubApplicationID;
    }

    /**
     * Sets club application id.
     *
     * @param clubApplicationID the club application id
     */
    public void setClubApplicationID(int clubApplicationID) {
        this.clubApplicationID = clubApplicationID;
    }

    /**
     * Gets pending club.
     *
     * @return the pending club
     */
    public Club getPendingClub() {
        return pendingClub;
    }

    /**
     * Sets pending club.
     *
     * @param pendingClub the pending club
     */
    public void setPendingClub(Club pendingClub) {
        this.pendingClub = pendingClub;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ClubApplication)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        ClubApplication that = (ClubApplication) o;
        return clubApplicationID == that.clubApplicationID && Objects.equals(pendingClub, that.pendingClub);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), clubApplicationID, pendingClub);
    }

    @Override
    public String toString() {
        return "ClubApplication{" +
                "clubApplicationID=" + clubApplicationID +
                ", pendingClub=" + pendingClub +
                '}';
    }
}
